<template>
	<view class="customer">
		<view class="search-box">
			<input type="text"/>
		</view>
		<view class="customerList">
			<view class="singleCust" @click="navToUserPage(topList.id)">
				<view class="portrait">
					<image :src="topList.avatar"></image>
				</view>
				<view class="customerText">
					<view>{{topList.name}}</view>
					<view>{{topList.code}}-{{topList.mobile}}</view>	
				</view>
			</view>
			<view class="singleCust" v-for="(item,index) in idList" :key="item.id" @click="navToUserPage(item.id)">
				<view class="portrait">
					<image :src="item.avatar"></image>
				</view>
				<view class="customerText">
					<view>{{item.name}}</view>
					<view>{{item.code}}-{{item.mobile}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {search,sTop,info} from "../../api/user.js"
	import {sendCard} from "../../api/course.js";
	import uniIndexedList from "@/components/uni-indexed-list/uni-indexed-list.vue"
	export default {
		components: {uniIndexedList},
		data() {
			return {
				idList:[],
				topList:[]
			}
		},
		methods:{
			async sTop(){
				const res = await sTop()
				this.idList= res.data
				this.topList = res.extra.topUser
				// this.idList = res
				// console.log(this.idList)
			},
			navToUserPage(id){
				uni.navigateTo({
					url:`/pages/userPage/userPage?id=${id}`
				})
			}
		},
		onLoad() {
			this.sTop()
		}
	}
</script>

<style lang="stylus" scoped>
.customer
	padding 0 20rpx

	.customerList
		
		.singleCust
			height 120rpx
			width 100%
			display flex
			align-items center
			.portrait
				image
					width 80rpx
					height 80rpx
			.customerText
				color #4E3D07
				font-size 26rpx
				font-weight 300
				margin-left 30rpx
</style>
